home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEM / S-Z / Special Delivery™ Demo.cpt / Special Delivery™ Demo / Claris / Claris Translators / EPSF.rsrc / PS_113 < prev    next >
Text File  |  1991-06-19  |  3KB  |  115 lines

  1. %%BeginProcSet : RGB4toGray4
  2.  /redTbl4   [0 0 1 1 1 1 2 2 3 3 3 4 4 4 5 5] def
  3.  /greenTbl4 [0 1 1 2 2 3 3 4 4 5 6 6 7 7 7 8] def
  4.  /blueTbl4  [0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2] def
  5.  /RGB4toGray4 {
  6.     currentfile RGBBuf readhexstring pop pop
  7.     /i 0 def
  8.     /j 0 def
  9.     grayBuf length {
  10.         RGBBuf i get dup
  11.         -4 bitshift redTbl4 exch get
  12.         exch 15 and greenTbl4 exch get add
  13.         RGBBuf i 1 add  get dup
  14.         -4 bitshift blueTbl4 exch get 3 -1 roll add  4 bitshift
  15.         exch 15 and redTbl4 exch get
  16.         RGBBuf i 2 add  get dup
  17.         -4 bitshift greenTbl4 exch get 3 -1 roll add
  18.         exch 15 and blueTbl4 exch get add or
  19.         grayBuf j 3 -1 roll put
  20.         /i i 3 add def
  21.         /j j 1 add def
  22.     } repeat
  23.     grayBuf
  24. } bind def
  25. %%EndProcSet
  26. %%BeginProcSet : RGB8toGray8
  27. /RGB8toGray8 {
  28.     currentfile RGBBuf readhexstring pop pop
  29.     /i 0 def
  30.     /j 0 def
  31.     grayBuf length {
  32.         RGBBuf i get 0.33 mul
  33.         RGBBuf i 1 add get 0.55 mul add
  34.         RGBBuf i 2 add get 0.12 mul add round cvi
  35.         grayBuf j 3 -1 roll put
  36.         /i i 3 add def
  37.         /j j 1 add def
  38.     } repeat
  39.     grayBuf
  40. } bind def
  41. %%EndProcSet
  42. %%BeginProcSet : RGB24toGray8
  43. /RGB24toGray8 {RGB8toGray8} bind def
  44. %%EndProcSet
  45. %%BeginProcSet : RGB2toGray2
  46.  /redTbl2   [0 0 1 1] def
  47.  /greenTbl2 [0 1 1 2] def
  48.  /blueTbl2  [0 0 0 0] def
  49.  /RGB2toGray2 {
  50.     currentfile RGBBuf readhexstring pop pop
  51.     /i 0 def
  52.     /j 0 def
  53.     grayBuf length {
  54.         RGBBuf i get dup dup dup
  55.         -6 bitshift redTbl2 exch get
  56.         exch -4 bitshift 3 and
  57.         greenTbl2 exch get add
  58.         exch -2 bitshift 3 and
  59.         blueTbl2 exch get add
  60.         6 bitshift exch 3 and
  61.         redTbl2 exch get
  62.         RGBBuf i 1 add  get dup dup dup
  63.         -6 bitshift greenTbl2 exch get
  64.         exch -4 bitshift 3 and
  65.         blueTbl2 exch get add
  66.         4 -1 roll add
  67.         4 bitshift 4 -1 roll or
  68.         3 1 roll -2 bitshift 3 and
  69.         redTbl2 exch get exch 3 and
  70.         greenTbl2 exch get add
  71.         RGBBuf i 2 add  get dup dup dup
  72.         -6 bitshift blueTbl2 exch get
  73.         5 -1 roll add
  74.         2 bitshift 5 -1 roll or
  75.         4 1 roll -4 bitshift 3 and
  76.         redTbl2 exch get
  77.         exch -2 bitshift 3 and
  78.         greenTbl2 exch get add
  79.         exch 3 and
  80.         greenTbl2 exch get add or
  81.         grayBuf j 3 -1 roll put
  82.         /i i 3 add def
  83.         /j j 1 add def
  84.     } repeat
  85.     grayBuf
  86. } bind def
  87. %%EndProcSet
  88. %%EndProcSet
  89. %%BeginProcSet : RGB1toGray1
  90. /RGB1toGray1 {
  91.     currentfile RGBBuf readhexstring pop pop
  92.     /i 0 def
  93.     /j 0 def
  94.     grayBuf length {
  95.         RGBBuf i get dup dup
  96.         1 bitshift 128 and exch
  97.         3 bitshift 64 and or exch
  98.         5 bitshift 32 and or
  99.         RGBBuf i 1 add get dup
  100.         -1 bitshift 16 and exch
  101.         1 bitshift 8 and or or
  102.         RGBBuf i 2 add get dup dup
  103.         -5 bitshift 4 and exch
  104.         -3 bitshift 2 and or exch
  105.         -1 bitshift 1 and or or
  106.         /i i 3 add def
  107.         /j j 1 add def
  108.     } repeat
  109.     grayBuf
  110. } bind def
  111. %%EndProcSet
  112. %%BeginProcSet : RGB16toGray8
  113. /RGB16toGray8 {RGB8toGray8} bind def
  114. %%EndProcSet